<?php
/**
 * The Sidebar containing the main widget area.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

$options = twentyeleven_get_theme_options();
$current_layout = $options['theme_layout'];


if ( 'content' != $current_layout ) :
?>
		<div id="sidebar">
		
			<div class="ads box">

				<ul>
					<li>
						<a href="http://themeforest.net/?ref=smuliii"><img width="125" height="125" src="<?php bloginfo('template_directory'); ?>/images/tf_125x125_v5.gif" alt="Themeforest"></a>
					</li>
					<li class="even">
						<a href="http://graphicriver.net/?ref=smuliii"><img width="125" height="125" src="<?php bloginfo('template_directory'); ?>/images/gr_125x125_v4.gif" alt="Graphicriver"></a>
					</li>
					<li>
						<a href="http://activeden.net/?ref=smuliii"><img width="125" height="125" src="<?php bloginfo('template_directory'); ?>/images/ad_125x125_v4.gif" alt="Activeden"></a>
					</li>
					<li class="even">
						<a href="http://codecanyon.net/?ref=smuliii"><img width="125" height="125" src="<?php bloginfo('template_directory'); ?>/images/cc_125x125_v1.gif" alt="CodeCanyon"></a>
					</li>
				</ul>
				
				<p class="align-center"><a href="#">Advertise With Us</a></p>

			</div><!-- end .ads -->
			
			<div id="recent-tabs" class="box">
			
				<div class="box-header">

					<ul class="nav">
						<li><a class="current" href="#recent-tabs-posts">热门文章</a></li>
						<li><a href="#recent-tabs-comments">本月</a></li>
                        <li><a href="#recent-tabs-comments1">本周</a></li>
                        <li><a href="#recent-tabs-comments2">昨天</a></li>
					</ul>

				</div><!-- end .box-header -->

				<div class="list-wrap">

					<ul id="recent-tabs-posts">
						<?php
                        $post_num = 5; // 设置调用条数
                        $args = array(
                        'post_password' => '',
                        'post_status' => 'publish', // 只选公开的文章.
                        'post__not_in' => array($post->ID),//排除当前文章
                        'caller_get_posts' => 1, // 排除置頂文章.
                        'orderby' => 'meta_value_num', // 依評論數排序.
                        'posts_per_page' => $post_num
                        );
                        $query_posts = new WP_Query();
                        $query_posts->query($args);
                        while( $query_posts->have_posts() ) { $query_posts->the_post(); ?>
						<li>
							<a href="<?php the_permalink(); ?>" class="title">
								<img src="<?php bloginfo('template_directory'); ?>/images/recent-posts-2.jpg" width="40" height="40" alt="">
								<?php the_title(); ?>
							</a>
							<p class="meta">Published on <a href="#">March 29, 2010</a> by <a href="#">John Doe</a></p>
						</li>
						<?php } wp_reset_query();?>

					</ul><!-- end #recent-tabs-posts-->

					<ul id="recent-tabs-comments" class="hide" style="position: relative; top: 0px; left: 0px; display: none; "><!--本月-->
					<?php if(function_exists('most_comm_posts')) most_comm_posts(30, 5); ?>
					</ul><!-- end #recent-tabs-comments -->

					<ul id="recent-tabs-comments1" class="hide" style="position: relative; top: 0px; left: 0px; display: none; "><!--本周-->
					<?php if(function_exists('most_comm_posts')) most_comm_posts(7, 5); ?>
					</ul><!-- end #recent-tabs-comments -->

					<ul id="recent-tabs-comments2" class="hide" style="position: relative; top: 0px; left: 0px; display: none; "><!--昨天-->
					<?php if(function_exists('most_comm_posts')) most_comm_posts(1, 5); ?>
					</ul><!-- end #recent-tabs-comments -->				</div><!-- end .list-wrap -->
				
			</div><!-- end #recent-tabs -->

			<div class="flickr-feed box">

				<div class="box-header">
					
					<h6 class="align-left"><img src="<?php bloginfo('template_directory'); ?>/images/icon-flickr-feed.png" alt="icon-flickr-feed" class="flickr-icon"> Our Flickr Group</h6>

					<a href="#" class="align-right">Sign In</a>

				</div><!-- end .box-header -->

				<ul>
					<li>
						<a href="http://www.flickr.com/photos/kwl/2432868269/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-1.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
					<li>
						<a href="http://www.flickr.com/photos/dexxus/4338578468/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-2.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
					<li>
						<a href="http://www.flickr.com/photos/extranoise/158135547/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-3.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
					<li>
						<a href="http://www.flickr.com/photos/18614695@N00/3472778601/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-4.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
					<li>
						<a href="http://www.flickr.com/photos/notsogoodphotography/466107969/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-5.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
					<li>
						<a href="http://www.flickr.com/photos/brunociampi/2487769238/">
							<img src="<?php bloginfo('template_directory'); ?>/images/flickr-6.jpg" width="75" height="75" alt="" class="flickr-image">
						</a>
					</li>
				</ul>

			</div><!-- end .flickr-feed -->

			<div class="tags box">

				<div class="box-header">

					<h6>TravelGuide Tags</h6>

				</div><!-- end .box-header -->

				<ul>
					<li><a href="#">New York City</a></li>
					<li><a href="#">Australia</a></li>
					<li><a href="#">Woods</a></li>
					<li><a href="#">Beach</a></li>
					<li><a href="#">Brooklyn</a></li>
					<li><a href="#">Bridge</a></li>
					<li><a href="#">Texas</a></li>
					<li><a href="#">2010</a></li>
					<li><a href="#">Palmtree</a></li>
					<li><a href="#">Miami</a></li>
					<li><a href="#">Museum</a></li>
					<li><a href="#">Native</a></li>
					<li><a href="#">American</a></li>
					<li><a href="#">Trips</a></li>
					<li><a href="#">Private</a></li>
					<li><a href="#">Family</a></li>
					<li><a href="#">Photo</a></li>
				</ul>

			</div><!-- end .tags -->

			<img src="<?php bloginfo('template_directory'); ?>/images/ad.gif" alt="ad" class="ad-bar">
			<a href="http://themeforest.net/?ref=smuliii"><img src="<?php bloginfo('template_directory'); ?>/images/tf_300x250_v5.gif" alt="tf_300x250_v5" class="ad"></a>

		</div><!-- end #sidebar -->
 
<?php endif; ?>

 